/*
	Implementation taken from http://www.two-kings.de/tutorials/dinput/dinput02.html
*/
#ifndef KEYBOARD_HELPER_H
#define KEYBOARD_HELPER_H

#define INITGUID
#define WIN32_LEAN_AND_MEAN
#define DIRECTINPUT_VERSION 0x0800
#include <windows.h>

#include <D3DX10.h>

#include <dinput.h>

namespace Utils{

	class KeyboardHandler
	{
	public:
		static void Init();
		static void CleanUp();

		static void Update();
		static bool IsKeyUp(int);
		static bool IsKeyDown(int);
		static bool IsSingleKeyDown(int);
		static bool IsSingleKeyUp(int);
		static bool IsReady(){return isReady;}

	private:
		static void InitDirectInput();
		static void InitKeyboard();

		static LPDIRECTINPUT8 directInput;
		static LPDIRECTINPUTDEVICE8 directInputDevice;

		static char KeyBuffer[256], LastKeyBuffer[256];

		static bool isReady;
	};
}

#endif